﻿#region License
// (c) Intergen.
// This source is subject to the Microsoft Public License (Ms-PL).
// Please see http://go.microsoft.com/fwlink/?LinkID=131993 for details.
// All other rights reserved.
#endregion

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Xml.Linq;

namespace TextGlow.Control.Model
{
  public class TableCell : Content
  {
    private List<DocumentContent> _content = new List<DocumentContent>();
    private TableCellProperties _properties;

    public new TableRow Parent
    {
      get { return (TableRow)base.Parent; }
      set { base.Parent = value; }
    }

    public TableCellProperties Properties
    {
      get { return _properties; }
      set { _properties = value; }
    }

    public List<DocumentContent> Content
    {
      get { return _content; }
    }

    public TableCell(TableRow parent, XElement element)
      : base(parent)
    {
      if (element == null)
        throw new ArgumentNullException("element");

      XNamespace ns = Document.WordprocessingML;

      _properties = new TableCellProperties(this, element.Element(ns + "tcPr"));

      _content.AddRange(DocumentContent.Create(this, element.Elements()));
    }
  }
}